import antfu from '@antfu/eslint-config'

export default antfu({
  extends: ['./.eslintrc-auto-import.json'],
  formatters: true,
  unocss: true,
  vue: {
    overrides: {
      'vue/block-order': [
        'error',
        {
          order: ['template', 'script', 'style'],
        },
      ],
    },
  },
  yaml: false,
  typescript: true,
  ignores: [
    '*.sh',
    '**/fixtures',
    'node_modules',
    '/node_modules',
    '*.md',
    '*.woff',
    '*.ttf',
    '*.iudea',
    '*/public',
    '.husky',
    '.local',
    '/bin',
    '*.mjs', // 忽略所有 .mjs 文件
  ],
  rules: {
    // 禁用未使用变量的检查
    'unused-imports/no-unused-vars': 'off',
    '@typescript-eslint/no-unused-vars': 'off',
    'no-unused-vars': 'off',
    'eqeqeq': 'off',
    'prefer-promise-reject-errors': 'off',
    'brace-style': '1tbs',
    // 'brace-style': 'off',
    // 'brace-style': ['warn', '1tbs'],
    'perfectionist/sort-imports': 'off',
    // 设置最大行长度为300
    'max-len': [
      'error',
      {
        code: 800,
        tabWidth: 2,
        ignoreUrls: true,
        ignoreStrings: true,
        ignoreTemplateLiterals: true,
        ignoreRegExpLiterals: true,
        ignoreComments: true,
      },
    ],
    // Vue模板中的最大行长度
    'vue/max-len': [
      'error',
      {
        code: 300,
        template: 800,
        tabWidth: 2,
        ignoreUrls: true,
        ignoreStrings: true,
        ignoreTemplateLiterals: true,
        ignoreRegExpLiterals: true,
        ignoreComments: true,
        ignoreHTMLAttributeValues: true,
        ignoreHTMLTextContents: true,
      },
    ],
    // 禁用HTML void元素自闭合检查
    'vue/html-self-closing': 'off',
     'vue/singleline-html-element-content-newline': 'off',
    // 关闭箭头函数参数括号的校验
    'arrow-parens': 'off',
    // 如果使用的是 @typescript-eslint，也需要关闭对应的规则
    '@typescript-eslint/arrow-parens': 'off',
    'style/arrow-parens': 'off',
    '@stylistic/arrow-parens': 'off',
  },
})
